{extend name='common/_container'} {block name="content"}
<style type="text/css">
	.layui-form-select .layui-input {
		padding-right: 30px;
		cursor: pointer;
		text-align: center;
	}
	.laydate-icon {
     border:none;
     background-image: none
}
.bank-info {

}
.bank-info li{
	margin:18px
}

.bank-info li input{
	border: 1px solid #fff;
	border-bottom: 1px solid #333;
}

.bank-info li span{
	    width: 170px;
	    display: inline-block;
	    text-align: initial;
}
/* 选择名字 */
.selectName{
	text-align: center;cursor: pointer;position:relative ;
}
.selectName ul{
	    background: #f5f5f5;
	    border: 1px solid #d0cece;
}
.selectName ul li{
	   border-bottom:1px solid #bbbaba;
}
.selectName ul li:hover{
	 background: #333;
	 color: #ffffff;
}
</style>
<link rel='stylesheet' href='__PUBLIC__/static/css/profile/demo.css'>
<link rel='stylesheet' href='__PUBLIC__/static/css/profile/addProfile.css'>

<div class="ibox float-e-margins">
	<input type="hidden" name='id' id='id' value="{$info.id}" />
	<div class="ibox-content">
		<div class="form-horizontal" id="CodeInfoForm">
			<div class="row" style="margin-top:-20px;">
				<div class="layui-tab layui-tab-brief" lay-filter="test">
					<ul class="layui-tab-title">
						<li class="layui-this" lay-id="1">身份证信息</li>
						<li lay-id="2">护照信息</li>
						<li lay-id="3">银行本翻译</li>
					</ul>
					<div class="layui-tab-content" style="margin-top:10px;">
						<div class="layui-tab-item layui-show">
							<div class="col-sm-12 layui-form">
								<!-- form start -->
								<form class="layui-form layui-form-pane" id="fromInfo">
									<div class="outCardInput" style="width:100%;height:600px;">
										<div class="idcard-positive" style="float: left;width:50%;">
											<div class="clearfix">
												<div class="nationalEmblem-Co">
													<div class="nationalEmblem">
													</div>
												</div>
												<div class="header">
													泰国国名身份证
													<div class="info">
														<div>身份证字号：<input placeholder="56565655545" name="id_card"  lay-verify="required" /></div>
														<div>姓名及姓氏：<input id="showName" readonly="readonly" lay-verify="required" /></div>
													</div>
												</div>
											</div>
											<div class="clearfix" style="position: relative;">
												<div class="imgCode">
													<img class="innerImg" src="__PUBLIC__/static/img/profile/card.png" />
												</div>
												<div class="cardInfo">
													<div>名字：<input name="first_name" id="show1"  placeholder="Mr. Wichai" /></div>
													<div>姓氏：<input name="last_name" id="show2"  placeholder="Baonak" /></div>
													<div>出生年月日 ：<input type="text" id="birthday" placeholder="选择时间" name="birth_day"></div>
													<div>宗教:<input name="religion" placeholder="佛教" /></div>
													<div>有效日期:<input type="text" name="expiry_day" placeholder="选择时间" /></div>
													<div class="address" style="width:240px;">
														住址:<input name="addr"  style="width:100%" id="addr" value="" placeholder="地址"/>
													</div>
													<div class="card-date">
														<div class="date-on">
															<input type="text"  id="issueDate" placeholder="选择时间" name="dispatch_day">
															<p>发证日期</p>
														</div>
														<div class="date-on" style="margin-left: -50px;text-align: center;">
															签名
															<input style="text-align: center;" type="text" placeholder="Arthit Boonyasopha" name="sign_name" />
														</div>
														<!-- <div class="date-on" style="float: right;margin-right: -25px;">
															<input type="text"  id="effectiveDate" placeholder="选择时间" name="expiry_day">
															<p>有效日期</p>
														</div> -->
													</div>
												</div>
												<div class="pic">
													<img style="width: 100px;opacity: .3;" src="__PUBLIC__/static/img/profile/pic.png" />
													<div><input name="id_card_posive_no" placeholder="4404-02-03011032"></div>
												</div>
											</div>
										</div>
										<div class="idcard-reverse" style="float: left;width:calc(50% - 40px);margin-left: 20px;">
											<div><input name="id_card_upside_no" placeholder="BORA-9.2-02-2560" /></div>
											<div class="clearfix">
												<div style="float:right">
													<img class="id_Img" style="" width="80" src="__PUBLIC__/static/img/profile/timg.gif" />
													<p class="id_Info">THAILAND<p>
												</div>
											</div>
											<div class="bottom-info">
												<input type="text" name="number_3" placeholder="ME0–1111974-26" />
											</div>
											<div class="outInfo">
												<p>编号：<input type="text" name="number" placeholder="265644" style="width: 30%;"><text class="outInfo-date"><input id="signDate" type="text" name="number_day" style="width: 90px;"  placeholder="选择日期" /> </text></p>
												<p><input type="text" name="number_1"  placeholder="BKK100" /> </p>
												<div class="signName">
													<div class="selectName" style="" id="selectName">
														认证官员选择
														<ul style="display: none;">
															<li id="1">MRS. CHUNEJIT SOMBOONSUK</li>
															<li id="2">MISS PRANEE PHOMSUPAR</li>
															<li id="3">MISS SAMARIN SIRISAWAT</li>
															<li id="4">MR. NATTAWUT SUPAWIT</li>
															<li id="5">MISS NUDTIDA LAWSUWAN</li>
															<li id="6">MRS SIRIWAN SAKORNNAWIN</li>
															<li id="7">MRS. MALEEWAN CHINAPRAYOON</li>
															<li id="8">MRS. NITIMA NOPAKUN</li>
															<li id="9">MISS WASANA PUMSI</li>
														</ul>
													</div>
													<div id="rzInfo">

													</div>

												</div>
												<div style="text-align: right;text-align: right;"><input type="text" name="number_2" placeholder="E3439032" style="font-size: 18px;text-align:right;" /></div>
											</div>
											<div class="sign_bottom">
												<p>本人（申请人） <input style="width: 50px;" type="text" name="numer_user" id="" value="" placeholder="小明" /> 聲明</p>
												<p> 上述 中文 譯本與 英文 原件文義相符</p>
												<p>簽 字：</p>
												<p>日 期：<input type="text" id="numer_sign_day" placeholder="选择时间" name="numer_sign_day"></p>
											</div>
										</div>

									</div>
								</form>
								<!-- form end -->
							</div>
						</div>

						<div class="layui-tab-item">
							<div class="col-sm-12">
								<!-- form start -->
								<div class="passport_information" style="width:100%;height:620px;background: #FFFFFF;">
									<div class="personInfo">
										<form id="personForm">
											<div class="passport_title">泰国外交部</div>
											<div>档案号:<input type="text" id="dah" style="border: none;" name="dah">使用者:<input type="text" id="user_2_name" style="border: none;" name="user_2_name"><span class="person_date">日期:<input id="user_2_day" style="border: none;" type="text" id="user_2_day" placeholder="选择时间" name="user_2_day"></span><button type="button" class="addBtn" id="addColumn" >新增</button></div>
										</form>
									</div>

									<div class="passport_form">
										<div class="passport_form_header clearfix">
											<div class="col-1 column">
												<p>序号</p>
											</div>
											<div class="col-2 column">
												<p>護照號碼</p>
												<p>姓名 (泰文)</p>
												<p>姓名 (英文)</p>
											</div>
											<div class="col-3 column">
												<p>國民身份證字號</p>
											</div>
											<div class="col-4 column">
												<p>出生日期</p>
												<p>性別</p>
												<p>微片</p>
											</div>
											<div class="col-5 column">
												<p>核發日期</p>
												<p>-類別</p>
												<p>-狀態</p>
											</div>
											<div class="col-6 column">
												<p>截止日期</p>
											</div>
											<div class="col-7 column">
												<p>操作</p>
											</div>
										</div>
										<div class="passport_form_body clearfix" id="formAdd">

											<!--<div class="col-item clearfix">
												<form>
													<div class="col-1 column">
														<p><input type="text" name="1" value="2" readonly="readonly" /></p>
													</div>
													<div class="col-2 column">
														<p><input type="text" name="2" value="L109136" /></p>
														<p><input type="text" name="3" value="WICHAI BAONAK" /></p>
														<p><input type="text" name="4" value="WICHAI BAONAK" /></p>
													</div>
													<div class="col-3 column">
														<p><input type="text" name="5" value="3-4404-00405-49-1" /></p>
													</div>
													<div class="col-4 column">
														<p><input type="text" name="6" value="21/12/1957" /></p>
														<p><input type="text" name="7" value="男性" /></p>
														<p><input type="text" name="8" value="M934 0197 00" /></p>
													</div>
													<div class="col-5 column">
														<p><input type="text" name="9" value="09/09/1991" /></p>
														<p><input type="text" name="10" value="-5 – 普通" /></p>
														<p><input type="text" name="11" value="C – 取消" /></p>
													</div>
													<div class="col-6 column">
														<p><input type="text" name="12" value="22/06/1994" /></p>
													</div>
													<div class="col-7 column" onclick="onDelete(this)">
														<p>删除</p>
													</div>
												</form>
											</div>-->
										</div>

									</div>
									<form id="signName">
									<div class="reconciliation clearfix">
										<div class="reconciliation_left">
											<div class="reconciliation-border">
												<p>编号：<input type="text" name="user_2_signNum1" placeholder="118774" style="border: none;"/><input id="proveData_time" name="proveData_time" placeholder="选择时间" style="border: none;text-align: right;"/></p>
												<p><input type="text"  name="user_2_signNum2" placeholder="BKK100" style="border: none;"/></p>
												<div class="content">
													<p>兹证明</p>
													<p><input type="text" name="user_2_person1" placeholder="CHATURONT CHAIYAKAM" style="border: none;text-align: center;"/></p>
													<p>之簽名屬實</p>
													<p> -簽名- </p>
													<div class="selectName" style="" id="selectName1">
														认证官员选择
														<ul style="display: none;">
															<li id="1">MRS. CHUNEJIT SOMBOONSUK</li>
															<li id="2">MISS PRANEE PHOMSUPAR</li>
															<li id="3">MISS SAMARIN SIRISAWAT</li>
															<li id="4">MR. NATTAWUT SUPAWIT</li>
															<li id="5">MISS NUDTIDA LAWSUWAN</li>
															<li id="6">MRS SIRIWAN SAKORNNAWIN</li>
															<li id="7">MRS. MALEEWAN CHINAPRAYOON</li>
															<li id="8">MRS. NITIMA NOPAKUN</li>
															<li id="9">MISS WASANA PUMSI</li>
														</ul>
													</div>
													<div id="rzInfo1">

													</div>

												</div>
											</div>
										</div>
										<div class="reconciliation_right">
											<p>核證資料正確</p>
											<p>-簽名-</p>
											<div class="selectName" style="" id="selectName3">
												送件官员选择
												<ul style="display: none;">
													<li id="1">Mrs. Sujittra Dhirawongprawes</li>
													<li id="2">Mr. Wijayane Surapolbhichet</li>
													<li id="3">Mr. Perapol Berananda</li>
												</ul>
											</div>
											<div id="rzInfo3">

											</div>

											<p><input type="text" name="user_2_date1" placeholder="2019年11月27日" style="border: none;text-align: center;"/></p>
											<p>本人（申請人） <input  name="personApplytion" placeholder="申明人" style="border: none;text-align: center;width: 55px;"/> 聲明</p>
											<p>上述 中文 譯本與 英文 原件文義相符</p>
											<p>簽 字：</p>
											<p>日 期：<input  style="border: none;" type="text" id="lastData_time" placeholder="选择时间" name="lastData_time"></p>
										</div>
									</div>
									</form>
								</div>

								<!-- form end -->
							</div>
						</div>

						<div class="layui-tab-item">
							<div class="col-sm-12">
								<!-- form start -->
									<div>
										<form id="bank_info">
										<ul class="bank-info">
											<li>
												<span>受款人姓名</span>
												<input type="text" placeholder="受款人姓名" name="payee_name" id="" value="{if condition=" $info.payee_name eq ''"}{$info.first_name}{$info.last_name}{else}{$info.payee_name}{/if}" />
											</li>
											<li>
												<span>受款人详细地址</span>
												<input type="text" style="width:450px;" placeholder="受款人详细地址" name="payee_addr" id="" value="{if condition=" $info.payee_addr eq ''"}{$info.addr}{else}{$info.payee_addr}{/if}" />
											</li>
											<li>
												<span>银行编号</span>
												<input id="bank_id"  type="text" placeholder="银行编号" name="bank_id" id="" value="{$info.bank_id}" />
											</li>
											<li>
												<span>银行代号</span>
												<input id="blurCode"  type="text" placeholder="银行代号" name="aba_code" id="" value="{$info.aba_code}" />
											</li>
											<li>
												<span>银行名称</span>
												<input type="text" placeholder="银行名称" name="bank_name" id="" value="{$info.bank_name}" />
											</li>
											<li>
												<span>分行(地址包括城市及国名)</span>
												<input type="text" style="width:550px;" placeholder="分行"  name="branch_bank" id="" value="{$info.branch_bank}" />
											</li>
											<li>
												<span>账号</span>
												<input type="text" placeholder="账号" name="bank_no" id="" value="{$info.bank_no}" />
											</li>
										</ul>
										</form>
									</div>
								<!-- form end -->
							</div>
						</div>

					</div>
				</div>
			</div>
			<div class="hr-line-dashed"></div>
			<div class="row btn-group-m-t">
				<div class="col-sm-9 col-sm-offset-1">
					<button type="button" class="btn btn-primary" lay-submit lay-filter="formDemo"  id="ensure">
						<i class="fa fa-check"></i>&nbsp;确认提交
					</button>
					<button type="button" class="btn btn-danger" onclick="CodeInfoDlg.close()" id="cancel">
						<i class="fa fa-eraser"></i>&nbsp;取消
					</button>
					<button type="button" class="btn btn-danger"  id="exportWord">
						<i class="fa fa-eraser"></i>&nbsp;导出word
					</button>
				</div>
			</div>
		</div>
	</div>
</div>
<script type='text/javascript' src='__PUBLIC__/static/js/laydate/laydate.js'></script>
<script src='__PUBLIC__/static/js/browser.min.js'></script>
<script type="text/javascript">
	// laydate.render({
  	// 	elem: '#birthday' //指定元素
	// });
	// laydate.render({
  	// 	elem: '#issueDate' //指定元素
	// });
	// laydate.render({
  	// 	elem: '#effectiveDate' //指定元素
	// });
	// laydate.render({
  	// 	elem: '#signDate' //指定元素
	// });
	// laydate.render({
  	// 	elem: '#numer_sign_day' //指定元素
	// });
	// laydate.render({
  	// 	elem: '#user_2_day' //指定元素
	// });
	// laydate.render({
  	// 	elem: '#proveData_time' //指定元素
	// });
	// laydate.render({
  	// 	elem: '#lastData_time' //指定元素
	// });
	isIE();
	function isIE() {
	    if(!!window.ActiveXObject || "ActiveXObject" in window){
	    	$(".passport_form .passport_form_header").css('marginRight','17px');

	    }else{
	      return false;
	　　 }
	}

</script>
<script src="__PUBLIC__/static/js/admin/record/Content.js?t=<?php echo rand(1000,9999)?>" charset="utf-8"></script>
<script src="__PUBLIC__/static/js/upload.js" charset="utf-8"></script>

<script src="__PUBLIC__/static/js/plugins/layui/layui.js?t=1498856285724" charset="utf-8"></script>
<link rel='stylesheet' href='__PUBLIC__/static/js/plugins/tagsinput/tagsinput.css'>
<script type='text/javascript' src='__PUBLIC__/static/js/plugins/tagsinput/tagsinput.min.js'></script>
<link href='__PUBLIC__/static/js/plugins/chosen/chosen.min.css' rel='stylesheet' />
<script src='__PUBLIC__/static/js/plugins/chosen/chosen.jquery.js'></script>
<script type="text/babel">

	layui.config({
		dir: '__PUBLIC__/static/js/plugins/layui/'
	});


	layui.use('element', function() {
		var element = layui.element();
		element.on('tab(test)', function(elem) {
			$("#ensure").attr('data-type', this.getAttribute('lay-id'));
			if(this.getAttribute('lay-id') == 3){
				$("#exportWord").hide()
			}else{
				$("#exportWord").show()
			}
		});

	});
	var idcard_info = {$info.idcard_info?$info.idcard_info:'null'};
	var passport_info = {$info.passport_info?$info.passport_info:'null'};
	console.log(JSON.stringify(passport_info));
	// console.log(JSON.stringify(idcard_info));
	console.log(idcard_info.idRzInfo);
	if(idcard_info.idRzInfo){
	 let strs="";
	 strs+=`
		<p>${idcard_info.idRzInfo.name}</p>
		<p>${idcard_info.idRzInfo.position}</p>
		<p>${idcard_info.idRzInfo.level}</p>
		<p>泰國外交部</p>
		`.trim();
		let Info = JSON.stringify(idcard_info.idRzInfo);
		$("#selectName").attr('info',Info);
		$("#rzInfo").html(strs);
	};
	if(passport_info.idRzInfo1){
	 let strs1="";
	 strs1+=`
		<p>${passport_info.idRzInfo1.name}</p>
		<p>${passport_info.idRzInfo1.position}</p>
		<p>${passport_info.idRzInfo1.level}</p>
		<p>泰國外交部</p>
		`.trim();
		let Info = JSON.stringify(passport_info.idRzInfo1);
		$("#selectName1").attr('info',Info);
		$("#rzInfo1").html(strs1);
	};
	if(passport_info.idSjInfo){
	 let strs2="";
	 strs2+=`
		<p>${passport_info.idSjInfo.name}</p>
		<p>${passport_info.idSjInfo.position}</p>
		<p>護照組</p>
		<p>-外交部章-</p>
		`.trim();

		let Info = JSON.stringify(passport_info.idSjInfo);
		$("#selectName3").attr('info',Info);
		$("#rzInfo3").html(strs2);
	};

	if(idcard_info != null && typeof idcard_info == "object"&&JSON.stringify(idcard_info) != "{}"){
		for ( let key in idcard_info ){
			if ( idcard_info[key] === '' ){
				delete idcard_info[key]
			}
		}

			for(let j in idcard_info){
				console.log('sasa');
				$("input[name="+j+"]").val(idcard_info[j]);
			}
			$("#showName").val(idcard_info['first_name']+idcard_info['last_name']);


	}
	if(passport_info != null ){

			let Arr = passport_info.arr;

			if(JSON.stringify(Arr[0]) != "{}"){
				let htmlstr="";
			for(let j=0;j<Arr.length;j++){
				 htmlstr += `<div class="col-item clearfix">
					<form>
						<div class="col-1 column">
							<p><input type="text" value="${j+1}" /></p>
						</div>
						<div class="col-2 column">
							<p><input type="text" name="user_2_number"  value=${Arr[j].user_2_number} placeholder="护照号码1"/></p>
							<p><input type="text" name="user_2_th" value=${Arr[j].user_2_th} placeholder="姓名 (泰文)"/></p>
							<p><input type="text" name="user_2_en" value=${Arr[j].user_2_en} placeholder="姓名 (英文)"/></p>
						</div>
						<div class="col-3 column">
							<p><input type="text" name="user_2_codeNum" value=${Arr[j].user_2_codeNum} placeholder="國民身份證字號"/></p>
						</div>
						<div class="col-4 column">
							<p><input type="text" name="user_2_birthDay"   value=${Arr[j].user_2_birthDay} placeholder="出生日期"/></p>
							<p><input type="text" name="user_2_sex" value=${Arr[j].user_2_sex?Arr[j].user_2_sex:"男性"} placeholder="性别"/></p>
							<p><input type="text" name="user_2_microfilm" value=${Arr[j].user_2_microfilm} placeholder="微片"/></p>
						</div>
						<div class="col-5 column">
							<p><input type="text"  name="user_approveDay"  value=${Arr[j].user_approveDay} placeholder="核發日期"/></p>
							<p><input type="text" name="user_2_kind" readonly="readonly" value="5-普通" placeholder="-類別"/></p>
							<p><input type="text" name="user_2_statu" readonly="readonly" value="C-取消" placeholder="–状态"/></p>
						</div>
						<div class="col-6 column">
							<p><input type="text"  name="user_2_endDate"  value=${Arr[j].user_2_endDate}   placeholder="截止日期"/></p>
						</div>
						<div class="col-7 column hook-delete" >
							<p >删除</p>
						</div>
					</form>
					</div>`;
			}
			$("#formAdd").html(htmlstr);
			// initTime1();
			}

			let {arr,...rest} = passport_info;
			for(let j in rest){
				$("input[name="+j+"]").val(rest[j]);
			}

	}
	function initTime(){
		laydate.render({elem:$("input[name='user_2_birthDay']")[0]});
		laydate.render({elem:$("input[name='user_approveDay']")[0]});
		laydate.render({elem:$("input[name='user_2_endDate']")[0]});

	}

	function initTime1(){
		$("#formAdd input[name='user_2_birthDay']").each(function(){
			laydate.render({elem:$(this)[0]})
		})
		$("#formAdd input[name='user_approveDay']").each(function(){
			laydate.render({elem:$(this)[0]})
		})
		$("#formAdd input[name='user_2_endDate']").each(function(){
			laydate.render({elem:$(this)[0]})
		})
	}
//聚焦渲染
	function showTxt(){
		let val1 = $("input[name='first_name']").val();
		let val2 = $("input[name='last_name']").val();
		$("#showName").val(val1+val2);
	}



	//再重新绑定新的事件

	$("#addColumn").bind("click", function() {
		addColumn()
		//do something;
	});
	$("#ensure").bind("click", function() {
		actionForm()
		//do something;
	});
	$("#exportWord").bind("click", function() {
		exportWord()
		//do something;
	});
	$(".hook-delete").each(function(){
		$(this).click(function(){
			onDelete(this);
		})
	});
	$("#show1").blur(function(){
		showTxt()
	})
	$("#show2").blur(function(){
		showTxt()
	})
//	$(".hook-delete").bind("click", function() {
//		console.log(this[0]);
////		onDeleted(this)
//		//do something;
//	});


	function addColumn() {
//		已有元素的length
		let i = passport_info == null ? 1:passport_info.arr.length;
		const el = $('#formAdd')[0];
		setTimeout(function() {
			$('#formAdd').scrollTop($('#formAdd')[0].scrollHeight + 200);
		}, 0)

		let htmlstr = `<div class="col-item clearfix"><form>
						<div class="col-1 column">
							<p><input type="text" value="${i}" /></p>
						</div>
						<div class="col-2 column">
							<p><input type="text" name="user_2_number" placeholder="护照号码"/></p>
							<p><input type="text" name="user_2_th" placeholder="姓名 (泰文)"/></p>
							<p><input type="text" name="user_2_en" placeholder="姓名 (英文)"/></p>
						</div>
						<div class="col-3 column">
							<p><input type="text" name="user_2_codeNum" placeholder="國民身份證字號"/></p>
						</div>
						<div class="col-4 column">
							<p><input type="text"  name="user_2_birthDay"  placeholder="出生日期"/></p>
							<p><input type="text" name="user_2_sex" value="男性" placeholder="性别"/></p>
							<p><input type="text" name="user_2_microfilm" placeholder="微片"/></p>
						</div>
						<div class="col-5 column">
							<p><input type="text" name="user_approveDay"  placeholder="核發日期"/></p>
							<p><input type="text"  name="user_2_kind" readonly="readonly" value="5-普通"  placeholder="-類別"/></p>
							<p><input type="text" name="user_2_statu" readonly="readonly" value="C-取消" placeholder="–状态"/></p>
						</div>
						<div class="col-6 column">
							<p><input type="text" name="user_2_endDate" placeholder="截止日期"/></p>
						</div>
						<div class="col-7 column hook-delete" >
							<p >删除</p>
						</div></form></div>`;
		$("#formAdd").append(htmlstr);
		// initTime1();
		$(".hook-delete").each(function(){
			$(this).click(function(){
				onDelete(this);
			})

		})

		setTimeout(function() {
			let a = $("#formAdd").find('.col-item').length;
			$(".col-item .col-1 input").each(function(index, element) {
				$(this).val(index + 1)
			});
		}, 0)

	}

	function onDelete(dom) {
		$(dom).parent().parent().remove();
		let a = $("#formAdd").find('.col-item').length;
		$(".col-item .col-1 input").each(function(index, element) {
			$(this).val(index + 1)
		});

	}

	$("#bank_id").blur(function(){
		var ajax = new $ax(Feng.ctxPath + "/Record.Bank/index", function (data) {
				console.log(data.rows[0]);
				let res = data.rows[0];
				if(res){
					$('input[name=aba_code]').val(res.aba_code);
					$('input[name=bank_name]').val(res.bank_name);
					$('input[name=branch_bank]').val(res.branch_bank);
					$('input[name=bank_no]').val(res.bank_no);
				}

		});
		let data = {
			type:1,
			bank_id:$("#bank_id").val(),
			limit:1,
			offset: 0
		}
		ajax.setData(data);
		ajax.start();
	});

	// 认证官员选择
	$("#selectName").click(function(){
		$("#selectName").find('ul').toggle();
	});
	$("#selectName li").click(function(){
		let arrRz=[{typeId:"1",type:"rz",name:"MRS. CHUNEJIT SOMBOONSUK",position:"普通服務官员",level:"經驗階級"},
			{typeId:"2",type:"rz",name:"MISS PRANEE PHOMSUPAR",position:"普通服務官员",level:"經驗階級"},
			{typeId:"3",type:"rz",name:"MISS SAMARIN SIRISAWAT",position:"法務官员",level:"執業階級"},
			{typeId:"4",type:"rz",name:"MR. NATTAWUT SUPAWIT",position:"法務官员",level:"執業階級"},
			{typeId:"5",type:"rz",name:"MISS NUDTIDA LAWSUWAN",position:"法務官员",level:"執業階級"},
			{typeId:"6",type:"rz",name:"MRS SIRIWAN SAKORNNAWIN",position:"總務官員",level:""},
			{typeId:"7",type:"rz",name:"MRS. MALEEWAN CHINAPRAYOON",position:"顧問",level:""},
			{typeId:"8",type:"rz",name:"MRS. NITIMA NOPAKUN",position:"外交官员",level:"專業階級"},
			{typeId:"9",type:"rz",name:"MISS WASANA PUMSI",position:"總務官員",level:""}];
		let str='';
		let id=$(this).attr('id');
		for(let i=0;i<arrRz.length;i++){
			if(arrRz[i].typeId == id){
				str+=`
				<p>${arrRz[i].name}</p>
				<p>${arrRz[i].position}</p>
				<p>${arrRz[i].level}</p>
				<p>泰國外交部</p>
				`.trim();
				let Info = JSON.stringify(arrRz[i]);
				$("#selectName").attr('info',Info);
			}
		}

		$("#rzInfo").html(str);
	});
	// 护照认证官员
	$("#selectName1").click(function(){
		$("#selectName1").find('ul').toggle();
	});

	$("#selectName1 li").click(function(){
		let arrRz=[{typeId:"1",type:"rz",name:"MRS. CHUNEJIT SOMBOONSUK",position:"普通服務官员",level:"經驗階級"},
			{typeId:"2",type:"rz",name:"MISS PRANEE PHOMSUPAR",position:"普通服務官员",level:"經驗階級"},
			{typeId:"3",type:"rz",name:"MISS SAMARIN SIRISAWAT",position:"法務官员",level:"執業階級"},
			{typeId:"4",type:"rz",name:"MR. NATTAWUT SUPAWIT",position:"法務官员",level:"執業階級"},
			{typeId:"5",type:"rz",name:"MISS NUDTIDA LAWSUWAN",position:"法務官员",level:"執業階級"},
			{typeId:"6",type:"rz",name:"MRS SIRIWAN SAKORNNAWIN",position:"總務官員",level:""},
			{typeId:"7",type:"rz",name:"MRS. MALEEWAN CHINAPRAYOON",position:"顧問",level:""},
			{typeId:"8",type:"rz",name:"MRS. NITIMA NOPAKUN",position:"外交官员",level:"專業階級"},
			{typeId:"9",type:"rz",name:"MISS WASANA PUMSI",position:"總務官員",level:""}];
		let str='';
		let id=$(this).attr('id');
		for(let i=0;i<arrRz.length;i++){
			if(arrRz[i].typeId == id){
				str+=`
				<p>${arrRz[i].name}</p>
				<p>${arrRz[i].position}</p>
				<p>${arrRz[i].level}</p>
				<p>泰國外交部</p>
				`.trim();
				let Info = JSON.stringify(arrRz[i]);
				$("#selectName1").attr('info',Info);
			}
		}

		$("#rzInfo1").html(str);
	});

	// s送件资料

	$("#selectName3").click(function(){
		$("#selectName3").find('ul').toggle();
	});
	$("#selectName3 li").click(function(){
		let arrSj=[{typeId:"1",type:"sj",name:"Mrs. Sujittra Dhirawongprawes",position:"主任"},
			{typeId:"2",type:"sj",name:"Mr. Wijayane Surapolbhichet",position:"顧問"},
			{typeId:"3",type:"sj",name:"Mr. Perapol Berananda",position:"顧問"}];
		let str='';
		let id=$(this).attr('id');
		for(let i=0;i<arrSj.length;i++){
			if(arrSj[i].typeId == id){
				str+=`
				<p>${arrSj[i].name}</p>
				<p>${arrSj[i].position}</p>
				<p>護照組</p>
				<p>-外交部章-</p>
				`.trim();
				let Info = JSON.stringify(arrSj[i]);
				$("#selectName3").attr('info',Info);
			}
		}

		$("#rzInfo3").html(str);
	});


	function actionForm() {
		$.fn.serializeObject = function() {
			var o = {};
			var a = this.serializeArray();
			$.each(a, function() {
				if(o[this.name]) {
					if(!o[this.name].push) {
						o[this.name] = [o[this.name]];
					}
					o[this.name].push(this.value || '');
				} else {
					o[this.name] = this.value || '';
				}
			});
			return o;
		};

		const type = $("#ensure").attr('data-type') == undefined ? 1 : $("#ensure").attr('data-type');
		var obj;
		let pass = true;
		if(type == 1) {
			$("#fromInfo input").each(function(index, elem) {
				if($(this).val() == "") {
					$(this).attr('placeholder', "请填写");
					$(this).addClass("invalid");
					pass = false;
					console.log($(this)[0])
					console.log(pass);
					return;
				}else{
					$(this).css("border", "1px solid white");

				}

			});
			 obj = $("#fromInfo").serializeObject();
			 obj['idRzInfo'] = JSON.parse($("#selectName").attr('info'))

		} else if(type == 2) {
			//验证
			$(".passport_form_body .col-item form input").each(function(item, element) {
				if($(this).val() == ""){
					$(this).attr('placeholder',"请填写");
					$(this).addClass("invalid");
					pass=false;
					return;
				}

			});
			$("#signName input").each(function(item, element){
					if($(this).val() == ""){
					$(this).attr('placeholder', "请填写");
					$(this).addClass("invalid");
					pass=false;
					return;
				}
			});
			$("#personForm input").each(function(item, element){
				if($(this).val() == ""){
					$(this).attr('placeholder', "请填写");
					$(this).addClass("invalid");
					pass=false;
					return;
				}
			});

			//取数据
			let arr = [];
			$(".passport_form_body .col-item").each(function(item, element) {

				console.log($(this).children('form')[0]);
				let item_form = $(this).children('form').serializeObject();
				console.log(item_form);
				arr.push(item_form);
			});

			//console.log(arr);
			let signForm = $("#signName").serializeObject();
			let dah = $("#dah").val();
			let user_2_name = $("#user_2_name").val();
			let user_2_day = $("#user_2_day").val();
			//let dah = $("#adh").val();
			obj = {arr,...signForm,user_2_name,user_2_day,dah};
			console.log($("#selectName1").attr('info')+"!!!");
			console.log($("#selectName3").attr('info')+"!!!");
			obj['idRzInfo1'] = JSON.parse($("#selectName1").attr('info'));
			obj['idSjInfo'] = JSON.parse($("#selectName3").attr('info'));
			//console.log(obj);return;
			for(var i in obj){
				if(obj[i] == ""){
					pass=false;

				}
			}

		}else if(type == 3){
			obj =  $("#bank_info").serializeObject();
		}

		let size = $(".passport_form_body").children('.col-item').length;
		console.log('走到这里');
		console.log(pass);
		console.log(size);
		if(size <1){
			layer.alert('至少保存一条护照信息！');
			return;
		}
		if(pass == true){
			var id = $('#id').val();
			Feng.confirm("是否更新？", function () {
				var ajax = new $ax(Feng.ctxPath + "/stepthree/update?type=" +type +"&id=" +id, function (data) {
					if ('00' === data.status) {
						Feng.success(data.msg);
						//CodeGoods.table.refresh();
					} else {
						Feng.error(data.msg);
					}
				});
				ajax.setData(JSON.stringify(obj));
				ajax.start();
			});
		}

	}
	function exportWord() {
		var id = $('#id').val();
		Feng.confirm("是否导出？", function () {
			var ajax = new $ax(Feng.ctxPath + "/stepthree/exportWord?"+"&id=" +id, function (data) {

				if ('00' === data.status) {
					//Feng.success(data.msg);
					console.log("/uploads/data/" + data.data.file_nm);
					window.location = "/download/data/" + data.data.file_nm;
					//CodeGoods.table.refresh();
				} else {
					Feng.error(data.msg);
				}
			});
			ajax.start();
		});
	}

</script>

{/block}
